package smart.src;

import org.openswing.swing.mdi.client.InternalFrame;
import org.openswing.swing.mdi.client.InternalFrame;
import org.openswing.swing.mdi.client.MDIFrame;
import org.openswing.swing.table.client.GridController;
import org.openswing.swing.table.columns.client.TextColumn;
import org.openswing.swing.util.client.ClientSettings;
import org.openswing.swing.client.CopyButton;
import org.openswing.swing.client.DeleteButton;
import org.openswing.swing.client.ExportButton;
import org.openswing.swing.client.GridControl;
import org.openswing.swing.client.ImportButton;
import org.openswing.swing.client.InsertButton;
import org.openswing.swing.client.ReloadButton;
import org.openswing.swing.client.SaveButton;
import java.awt.BorderLayout;
import java.awt.Color;

import org.openswing.swing.client.EditButton;
import java.awt.FlowLayout;
import java.sql.Connection;

import javax.swing.JPanel;

public class CardStatusGridFrame extends InternalFrame {
	GridControl grid = new GridControl();
	JPanel buttonsPanel = new JPanel();
	ReloadButton reloadButton = new ReloadButton();
	DeleteButton deleteButton = new DeleteButton();
	FlowLayout flowLayout1 = new FlowLayout();
	TextColumn colCardStatusId = new TextColumn();
	TextColumn colDescription = new TextColumn();
	InsertButton insertButton = new InsertButton();
	EditButton editButton = new EditButton();
	SaveButton saveButton = new SaveButton();
	CopyButton copyButton = new CopyButton();
	ExportButton exportButton = new ExportButton();
	ImportButton importButton1 = new ImportButton();

	public CardStatusGridFrame(CardStatusGridFrameController controller) {
		try {
			jbInit();
			setSize(500, 300);
			grid.setController(controller);
			grid.setGridDataLocator(controller);
			setTitle("Statuses");
			MDIFrame.add(this);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	private void jbInit() throws Exception {
		grid.setFunctionId("getCardStatus");
		grid.setImportButton(importButton1);
		buttonsPanel.setLayout(flowLayout1);
		flowLayout1.setAlignment(FlowLayout.LEFT);
		grid.setCopyButton(copyButton);
		grid.setDeleteButton(deleteButton);
		grid.setEditButton(editButton);
		grid.setExportButton(exportButton);
		grid.setInsertButton(insertButton);
		grid.setReloadButton(reloadButton);
		grid.setSaveButton(saveButton);
		grid.setValueObjectClassName("src.VO.CardStatusVO");
		colCardStatusId.setColumnFilterable(true);
		colCardStatusId.setColumnName("idstatus");
		colCardStatusId.setColumnSortable(true);
		colCardStatusId.setEditableOnInsert(true);
		colCardStatusId.setMaxCharacters(5);
		colCardStatusId.setTrimText(true);
		colCardStatusId.setUpperCase(true);

		colDescription.setColumnDuplicable(true);
		colDescription.setColumnName("stat");
		colDescription.setEditableOnEdit(true);
		colDescription.setEditableOnInsert(true);


		insertButton.setText("insertButton1");
		editButton.setText("editButton1");
		saveButton.setText("saveButton1");
		this.setUniqueInstance(true);
		this.getContentPane().add(grid, BorderLayout.CENTER);
		this.getContentPane().add(buttonsPanel, BorderLayout.NORTH);
		buttonsPanel.add(insertButton, null);
		buttonsPanel.add(copyButton, null);
		buttonsPanel.add(editButton, null);
		buttonsPanel.add(reloadButton, null);
		buttonsPanel.add(saveButton, null);
		buttonsPanel.add(importButton1, null);
		buttonsPanel.add(exportButton, null);
		buttonsPanel.add(deleteButton, null);
		grid.getColumnContainer().add(colCardStatusId, null);
		grid.getColumnContainer().add(colDescription, null);
	}

	@Override
	public Color getBackground() {
		// TODO Auto-generated method stub
		return super.getBackground();
	}
}
